{__NOLAYOUT__}
{if request()->isMobile()}
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
{/if}
{include file="public/head" /}
<title>配置管理</title>
{include file="public/index_css" /}
<script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script></head>

<body class="nav-md">
<div class="container body">
    <div class="main_container">
        {include file="public/left" /}
        <!-- top navigation -->
        {include file="public/top" /}
        <!-- /top navigation -->

        <!-- page content -->
        <div class="right_col" role="main">

            <div class="x_panel">
                <div class="x_title">
                    <h2><i class="fa fa-bars"></i> 配置管理 </h2>
                    <ul class="nav navbar-right panel_toolbox">
                        <li class="dropdown">
                            <a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
                        </li>
                        <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                        </li>
                        <li><a class="close-link"><i class="fa fa-close"></i></a>
                        </li>
                    </ul>
                    <div class="clearfix"></div>
                </div>
                <div class="x_content">

                    <div class="" role="tabpanel" data-example-id="togglable-tabs">
                        <ul id="myTab" class="nav nav-tabs bar_tabs" role="tablist">
                            {volist name='data' id='list'}
                            <li role="presentation" class="{empty name='$key'}active{/empty}">
                                <a href="#tab_content{$key}" id="tab{$key}" role="tab" data-toggle="tab"
                                   aria-expanded="{empty name='$key'}true{else /}false{/empty}"> {$list.title} </a>
                            </li>
                            {/volist}

                            <li role="presentation" class="">
                            <a href="#tab_content888" id="tab888" role="tab" data-toggle="tab"
                            aria-expanded="false"> 图片设置 </a>
                            </li>
                            <li role="presentation" class="">
                                <a href="#tab_content999" id="tab999" role="tab" data-toggle="tab"
                                   aria-expanded="false"> 添加新变量 </a>
                            </li>

                        </ul>

                        <div id="myTabContent" class="tab-content">
                            {volist name='data' id='list'}
                            <div role="tabpanel" class="tab-pane fade {empty name='$key'}active in{/empty}"
                                 id="tab_content{$key}" aria-labelledby="tab{$key}">
                                <form name="form" method="post" action="">
                                    {volist name='list["config"]' id='config'}
                                    <div class="form-group has-success " style="margin: 1% 1%;font-size: 16px;">
                                        <div style="float: left;margin: 5px 0;clear: both">{$config.varinfo}：</div>
                                        <div style="clear: both"></div>
                                        {switch name="config.vartype"}

                                        {case value="string"}
                                        <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                            <input class="form-control" type="text" name="{$config.varname}"
                                                   value="{$config.varvalue}">
                                        </div>
                                        {/case}

                                        {case value="number"}
                                        <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                            <input class="form-control" type="number" name="{$config.varname}"
                                                   value="{$config.varvalue}">
                                        </div>
                                        {/case}

                                        {case value="bool"}
                                        <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                            <label class="radio_box">
                                                <input type="radio" class="flat" name="{$config.varname}"
                                                       id="{$config.varname}_1" value="Y" {if
                                                       condition="$config['varvalue'] eq 'Y'" } checked {/if} />&nbsp;
                                                <label for="{$config.varname}_1"></label>
                                                <span>是</span>
                                            </label>
                                            &nbsp;&nbsp;
                                            <label class="radio_box">
                                                <input type="radio" class="flat" name="{$config.varname}"
                                                       id="{$config.varname}_2" value="N" {if
                                                       condition="$config['varvalue'] eq 'N'" } checked {/if} />&nbsp;
                                                <label for="{$config.varname}_2"></label>
                                                <span>否</span>
                                            </label>
                                        </div>
                                        {/case}

                                        {case value="bstring"}
                                        <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                                <textarea class="form-control" style="height: 120px;"
                                                          name="{$config.varname}">{$config.varvalue}</textarea>
                                        </div>
                                        {/case}

                                        {default /}参数错误

                                        {/switch}
                                        <div style="margin-top: 5px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${$config.varname}</div>
                                        <!--<input type="hidden" name="id" value="{$config.id}">-->
                                    </div>

                                    {/volist}
                                    {eq name="list.id" value="1"}
                                    <div class="form-group has-success " style="margin: 1% 1%;font-size: 16px;">

                                        <div style="clear: both"></div>
                                        {notempty name=":cache('name')"}
                                        <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                            <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                                <label class="radio_box">
                                                    <input type="radio" class="flat" name="login"
                                                           id="{$config.varname}_1" value="Y" {if
                                                           condition="$config['varvalue'] eq 'Y'" } checked {/if} />&nbsp;
                                                    <label for="{$config.varname}_1"></label>
                                                    <span>退出</span>
                                                </label>
                                                &nbsp;&nbsp;

                                            </div>
                                        </div>
                                        {/notempty}
                                    </div>
                                    {/eq}

                                    <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3" style="margin-top: 20px;">
                                        <button type="submit" class="btn btn-success">提交</button>
                                        <div  class="btn btn-primary" onclick="history.go(-1)">返回</div>
                                    </div>
                                </form>
                            </div>
                            {/volist}
                            <div role="tabpanel" class="tab-pane fade" id="tab_content888" aria-labelledby="tab{$key}">
                                <form name="form" method="post" action="" enctype="multipart/form-data">

                                    <div style="width: 500px;float: left;margin-left: 21px;" class="imageupload panel panel-default">
                                        <div class="panel-heading clearfix">
                                            <h3 class="panel-title pull-left">网站Logo</h3>
                                            <div class="btn-group pull-right">
                                                <!--<button type="button" class="btn btn-default active">文件</button>-->
                                                <!--<button type="button" class="btn btn-default">链接</button>-->
                                            </div>
                                        </div>
                                        <div data-am-widget="gallery" class="am-gallery am-avg-sm-2
am-avg-md-3 am-avg-lg-4 am-gallery-overlay" data-am-gallery="{ pureview: true }" id="imgdiv_logo" style="display: inline-block;">
                                            <img id="imgShow_logo" onerror="this.src='__CONSOLE__/default.png'" src="{:cache('logo')}" alt="Image preview" class="thumbnail" style="width:174px;height: 120px"/>
                                            <label class="btn btn-default">选择文件
                                                <input type="file" id="up_img_logo" name="logo" style="display: none;"/>
                                            </label>
                                        </div>
                                    </div>

                                    <div style="width: 500px;float: left;margin-left: 21px;" class="imageupload panel panel-default">
                                        <div class="panel-heading clearfix">
                                            <h3 class="panel-title pull-left">网站Logo</h3>
                                            <div class="btn-group pull-right">
                                                <!--<button type="button" class="btn btn-default active">文件</button>-->
                                                <!--<button type="button" class="btn btn-default">链接</button>-->
                                            </div>
                                        </div>
                                        <div data-am-widget="gallery" class="am-gallery am-avg-sm-2
am-avg-md-3 am-avg-lg-4 am-gallery-overlay" data-am-gallery="{ pureview: true }" id="imgdiv4" style="display: inline-block;">
                                            <img id="imgShow4" onerror="this.src='__CONSOLE__/default.png'" src="{:cache('logo2')}" alt="Image preview" class="thumbnail" style="width:174px;height: 120px"/>
                                            <label class="btn btn-default">选择文件
                                                <input type="file" id="up_img4" name="logo2" style="display: none;"/>
                                            </label>
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3" style="margin-top: 20px;">
                                        <button type="submit" class="btn btn-success">提交</button>
                                        <div  class="btn btn-primary" onclick="history.go(-1)">返回</div>
                                    </div>
                                </form>
                            </div>

                            <!--与代码无关可以删除-->
                            <link rel="stylesheet" href="__CONSOLE__/amazeui/amazeui.min.css" />
                            <script src="__CONSOLE__/amazeui/jquery.min.js"></script>
                            <script src="__CONSOLE__/amazeui/amazeui.js"></script>

                            <script type="text/javascript">
                                function preview(obj){
                                    var img = document.getElementById("previewimg");
                                    img.src = window.URL.createObjectURL(obj.files[0]);
                                }
                            </script>
                            <!-- jQuery -->
                            <!--<script src="https://cdn.bootcss.com/jquery/2.0.0/jquery.js"></script>-->
                            <script src="__CONSOLE__/vendors/uploadPreview.js"></script>
                            <!--<form action="__SELF__" method="post" enctype="multipart/form-data">-->
                            <!--<div class="uploadPreviewContainer">-->
                            <!--<div id="imgdiv" class="float_left width_33">-->
                            <!--<img id="imgShow" width="120" height="120"/>-->
                            <!--<input type="file" id="up_img" />-->
                            <!--<div onclick="rem(this)">remove</div>-->
                            <!--</div>-->
                            <!--<div class="clear_both"></div>-->
                            <!--</div>-->
                            <!--</form>-->
                            <script type="text/javascript">
                                // new uploadPreview({ UpBtn: "user_logo",Width: 20,Height: 20, ImgShow: "user_logo_im" ,callback: function() { }});
                                new uploadPreview({UpBtn: "up_img_logo", DivShow: "imgdiv_logo", ImgShow: "imgShow_logo", callback: function(){}});
                                new uploadPreview({UpBtn: "up_img4", DivShow: "imgdiv4", ImgShow: "imgShow4", callback: function(){}});



                            </script>
                            <div role="tabpanel" class="tab-pane fade" id="tab_content999" aria-labelledby="tab999">
                                <form name="form" method="post" action="{:url('config/addVariables')}" enctype="multipart/form-data">

                                    <div class="form-group" style="margin: 1% 1%;font-size: 16px;">
                                        <div style="float: left;margin: 5px 0;clear: both">所属配置组：</div>
                                        <div style="clear: both"></div>
                                        <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                            <select name="vargroup" id="vargroup" class="select2" style="width: 500px;" tabindex="-1">
                                                <option></option>
                                                {volist name='data' id='list'}
                                                <option value="{$list.id}">{$list.title}</option>
                                                {/volist}
                                            </select>
                                        </div>
                                    </div>

                                    <div class="form-group" style="margin: 1% 1%;font-size: 16px;">
                                        <div style="float: left;margin: 5px 0;clear: both">变量名称：</div>
                                        <div style="clear: both"></div>
                                        <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                            <input class="form-control" type="text" name="varname" placeholder="系统会自动为变量添加 '$web_' 前缀">
                                        </div>
                                    </div>

                                    <div class="form-group" style="margin: 1% 1%;font-size: 16px;">
                                        <div style="float: left;margin: 5px 0;clear: both">参数说明：</div>
                                        <div style="clear: both"></div>
                                        <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                            <input class="form-control" type="text" name="varinfo" placeholder="变量的描述信息">
                                        </div>
                                    </div>

                                    <div class="form-group" style="margin: 1% 1%;font-size: 16px;">
                                        <div style="float: left;margin: 5px 0;clear: both">变量值：</div>
                                        <div style="clear: both"></div>
                                        <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                            <input class="form-control" type="text" name="varvalue" placeholder="请填写变量值">
                                        </div>
                                    </div>

                                    <div class="form-group" style="margin: 1% 1%;font-size: 16px;">
                                        <div style="float: left;margin: 5px 0;clear: both">变量类型</div>
                                        <div style="clear: both"></div>
                                        <div class="col-md-4" style="margin-left: -10px;margin-top: 2px;">
                                            <label class="radio_box">
                                                <input type="radio" id="vartype_1" name="vartype" value="string" checked />&nbsp;
                                                <label for="vartype_1"></label>
                                                <span>文本</span>
                                                &nbsp;&nbsp;
                                            </label>
                                            <label class="radio_box">
                                                <input type="radio" id="vartype_2" name="vartype" value="number" />&nbsp;
                                                <label for="vartype_2"></label>
                                                <span>数字</span>
                                                &nbsp;&nbsp;
                                            </label>
                                            <label class="radio_box">
                                                <input type="radio" id="vartype_3" name="vartype" value="bool" />&nbsp;
                                                <label for="vartype_3"></label>
                                                <span>布尔(Y/N)</span>
                                                &nbsp;&nbsp;
                                            </label>
                                            <label class="radio_box">
                                                <input type="radio" id="vartype_4" name="vartype" value="bstring" />&nbsp;
                                                <label for="vartype_4"></label>
                                                <span>多行文本</span>
                                                &nbsp;&nbsp;
                                            </label>
                                        </div>
                                    </div>

                                    <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3"
                                         style="margin-top: 20px;">
                                        <button type="submit" class="btn btn-success">提交</button>
                                        <div  class="btn btn-primary" onclick="history.go(-1)">返回</div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
    <!-- /page content -->
    <!-- footer content -->
    {include file="public/foot" /}
    <!-- /footer content -->
</div>
</div>

{include file="public/index_js"}
</body>
</html>